<ui:composition
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.prime.com.tr/ui"
        xmlns:finantial="http://java.sun.com/jsf/composite/components/finantial"
        xmlns:c="http://java.sun.com/jsp/jstl/core">

    <p:panel>
        <h:panelGrid id="income_type_grid" columns="2">
            <finantial:label for="income_type_description" value="Descrição:"/>
            <finantial:input id="income_type_description" value="#{configurationBean.incomeType.description}" form="income_type_form" messages="income_type_msg"/>
        </h:panelGrid>
        <div align="center">
            <h:panelGrid columns="2" cellspacing="10">
                <p:commandButton value="salvar" action="#{configurationBean.addIncomeType}" update="config_form:income_types income_type_msg" oncomplete="handleAddIncomeType(xhr, status, args)"/>
            </h:panelGrid>
        </div>
        <p:messages id="income_type_msg"/>
    </p:panel>

   <script type="text/javascript">
    function handleAddIncomeType(xhr, status, args){
        if(! args.failled){
            setTimeout("waitAddIncomeType()",1000);

            return true;
        }
        return false;
    }

    function waitAddIncomeType(){
        incometypeModal.hide();
    }

</script>
</ui:composition>